﻿using AutoMapper;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using WMS.FC.Domain.DomainObject.System;
using WMS.FC.Domain.DomainObject.Tasks;
using WMS.FC.Domain.Service.System;
using WMS.FC.Domain.Service.Tasks.Interface;

namespace WMS.FC.Domain.Service.Tasks
{
    public class GetEmptyTrayOutboundTaskService : ServiceBase, IGetEmptyTrayOutboundTaskService
    {
        public GetEmptyTrayOutboundTaskService(
            ILogger<ServiceBase> logger,
            IOptions<WmsSettings> options,
            IMapper mapper)
            : base(logger, options, mapper)
        {

        }

        public async Task<ActionResult<TaskDO>> GetEmptyTrayOutboundTask(string? stationCode, string? MaterialCode, string? EquipmentCode, UserInfo userInfo)
        {
            var result = new ActionResult<TaskDO>("申请空托盘出库");
            try
            {
                if (string.IsNullOrWhiteSpace(stationCode))
                    return result.ArgumentError("站台编码不能为空");

                if (string.IsNullOrWhiteSpace(MaterialCode))
                    return result.ArgumentError("站台编码不能为空");

            }
            catch (Exception ex)
            {
                return result.Exception(ex);
            }

            return result;
        }
    }
}
